package com.example.homework4;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity2 extends AppCompatActivity {

    private TextView textview;
    private TextView textview2;
    private TextView textview3;
    private Button button;
    private Button button2;
    private Button button3;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);


        Intent intent=getIntent();
        String editText=intent.getStringExtra("com.example.homework4.editText");
        String editText2=intent.getStringExtra("com.example.homework4.editText2");
        String editText3=intent.getStringExtra("com.example.homework4.editText3");
        textview=(TextView) findViewById(R.id.textView);
        textview2=(TextView) findViewById(R.id.textView2);
        textview3=(TextView) findViewById(R.id.textView3);
        textview.setText(editText);
        textview2.setText(editText2);
        textview3.setText(editText3);

        button=(Button) findViewById(R.id.button);
        button2=(Button) findViewById(R.id.button2);
        button3=(Button) findViewById(R.id.button3);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent();
                intent.setAction("android.intent.action.VIEW");
                intent.setData(Uri.parse("https://m.baidu.com/?from=844b&vit=fps"));
                startActivity(intent);
            }
        });
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=getPackageManager().getLaunchIntentForPackage("tv.danmaku.bili");
                startActivity(intent);
            }
        });
        /*button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=getPackageManager().getLaunchIntentForPackage();
                startActivity(intent);
            }
        });*/
    }
}